package br.usp.ime.protoc.genotipagem;

import java.util.HashSet;
import java.util.Iterator;

import com.google.gwt.user.client.rpc.IsSerializable;

import br.usp.ime.protoc.fujaba.FEmptyIterator;

public abstract class Tubo implements IsSerializable
{
   private String dataExtracao;

   public String getDataExtracao()
   {
      return this.dataExtracao;
   }

   public void setDataExtracao(String value)
   {
      if (this.dataExtracao != value)
      {
         
         this.dataExtracao = value;
         
      }
   }

   private int id;

   public int getId()
   {
      return this.id;
   }

   public void setId(int value)
   {
      if (this.id != value)
      {
         
         this.id = value;
         
      }
   }

   private String localArmazenamento;

   public String getLocalArmazenamento()
   {
      return this.localArmazenamento;
   }

   public void setLocalArmazenamento(String value)
   {
      if (this.localArmazenamento != value)
      {
         
         this.localArmazenamento = value;
         
      }
   }

   private String localExtracao;

   public String getLocalExtracao()
   {
      return this.localExtracao;
   }

   public void setLocalExtracao(String value)
   {
      if (this.localExtracao != value)
      {
         
         this.localExtracao = value;
         
      }
   }

   private String responsavel;

   public String getResponsavel()
   {
      return this.responsavel;
   }

   public void setResponsavel(String value)
   {
      if (this.responsavel != value)
      {
         
         this.responsavel = value;
         
      }
   }

   private String volume;

   public String getVolume()
   {
      return this.volume;
   }

   public void setVolume(String value)
   {
      if (this.volume != value)
      {
         
         this.volume = value;
         
      }
   }

   /**
    * <pre>
    *       1       has        1..* 
    * Tubo ------------------------- EstudoDestino
    *       tubo      estudoDestino 
    * </pre>
    */
   private HashSet estudoDestino;

   public boolean addToEstudoDestino(EstudoDestino value)
   {
      boolean changed = false;
      if (value != null)
      {
         if (this.estudoDestino == null)
         {
            this.estudoDestino = new HashSet (); // or FTreeSet () or FLinkedList ()
         }
         
         changed = this.estudoDestino.add (value);
         if (changed)
         {
            value.setTubo (this);
         }
         
      }
      return changed;
   }

   public boolean hasInEstudoDestino(EstudoDestino value)
   {
      return ((this.estudoDestino != null) &&
              (value != null) &&
              this.estudoDestino.contains (value));
   }

   public Iterator iteratorOfEstudoDestino()
   {
      return ((this.estudoDestino == null)
              ? FEmptyIterator.get ()
              : this.estudoDestino.iterator ());
   }

   public void removeAllFromEstudoDestino()
   {
      EstudoDestino tmpValue;
      Iterator iter = this.iteratorOfEstudoDestino ();
      while (iter.hasNext ())
      {
         tmpValue = (EstudoDestino) iter.next ();
         this.removeFromEstudoDestino (tmpValue);
      }
   }

   public boolean removeFromEstudoDestino(EstudoDestino value)
   {
      boolean changed = false;
      if ((this.estudoDestino != null) && (value != null))
      {
         
         changed = this.estudoDestino.remove (value);
         if (changed)
         {
            value.setTubo (null);
         }
         
      }
      return changed;
   }

   public int sizeOfEstudoDestino()
   {
      return ((this.estudoDestino == null)
              ? 0
              : this.estudoDestino.size ());
   }

   public void removeYou()
   {
      removeAllFromEstudoDestino ();
   }

}
